<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <title>購物車頁</title>

    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">

    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="icon" type="image/png" href="assets/i/examples/favicon.ico">

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="assets/i/app-icon72x72@2x.png">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">

    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="assets/i/app-icon72x72@2x.png">
    <meta name="msapplication-TileColor" content="#0e90d2">

    <link rel="stylesheet" href="assets/css/amazeui.min.css">
    <link rel="stylesheet" href="assets/css/app.css">

    <link rel="stylesheet" href="assets/css/new-style.css">


    <style>
        .dian{
            border: 1px solid #b10000!important;
        }
    </style>

</head>
<body>

    <div class="am-u-sm-12 sc-header">
        <div class="am-u-sm-4 sc-img" style="padding: 0;">
            <img style="width: 100%; height: 100%" src="assets/i/examples/gnib.jpg" alt=""/>
        </div>
        <div class="am-u-sm-8 sc-main">
            <div class="sc-back" style="text-align: right;" onclick="location='m-details.html'"><img src="assets/i/examples/sc-back.png" alt=""></div>
            <div class="sc-price">$999</div>
            <div class="sc-warehouse">庫存：99件</div>
            <div class="sc-selected">已選擇：W288 黑色2</div>
        </div>
    </div>

    <div class="am-u-sm-12 size">
        <div class="sz-title">尺碼</div>
        <div class="am-u-sm-12" style="padding: 0; text-align: center;">
            <div class="am-u-sm-4" style="padding: 0; margin-bottom: 10px;">
                <span id="size-list" class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">W288</span>
            </div>
            <div class="am-u-sm-4" style="padding: 0; margin-bottom: 10px;">
                <span class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">W288</span>
            </div>
            <div class="am-u-sm-4" style="padding: 0; margin-bottom: 10px;">
                <span class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">W288</span>
            </div>
            <div class="am-u-sm-4" style="padding: 0; margin-bottom: 10px;">
                <span class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">W288</span>
            </div>
            <div class="am-u-sm-4" style="padding: 0; margin-bottom: 10px;">
                <span class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">W288</span>
            </div>
            <div class="am-u-sm-4" style="padding: 0; margin-bottom: 10px;">
                <span class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">W288</span>
            </div>
        </div>
    </div>

    <div class="am-u-sm-12 color">
        <div class="co-title">顏色分類</div>
        <div class="am-u-sm-12" style="padding: 0; text-align: center;">
            <div class="am-u-sm-3" style="padding: 0; margin-bottom: 10px;">
                <span id="color-list" class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">灰色</span>
            </div>
            <div class="am-u-sm-3" style="padding: 0; margin-bottom: 10px;">
                <span class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">黑色</span>
            </div>
            <div class="am-u-sm-3" style="padding: 0; margin-bottom: 10px;">
                <span class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">黑色1</span>
            </div>
            <div class="am-u-sm-3" style="padding: 0; margin-bottom: 10px;">
                <span class="am-u-sm-10" style="border: 1px solid #e5e5e5; border-radius: 5px; padding: 5px 0;">藏藍色</span>
            </div>
        </div>
    </div>

    <div class="am-u-sm-12 number">
        <div class="nu-title">數量</div>
                <div class="am-u-sm-2" style="padding: 0;">
                <button id="min" type="button" class="am-btn am-btn-default am-u-sm-11"><i class="am-icon-minus"></i></button>
                </div>
                <div class="am-u-sm-3" style="padding: 0;">
                <input id="num" class="am-form-field" style="text-align: center;" type="text" name="num" maxlength="40" value="1" placeholder="请输入购买數量"/>
                </div>
                <div class="am-u-sm-2" style="padding: 0; float: left; margin-left: 5px;">
                <button id="add" type="button" class="am-btn am-btn-default am-u-sm-11"><i class="am-icon-plus"></i></button>
        </div>
    </div>

    <div class="am-u-sm-12 sc-footer" onclick="location='m-details.html'">
        <div id="sure" class="sure">確定</div>
    </div>

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<script src="assets/js/amazeui.min.js"></script>

    <script>

        $(document).ready(function () {

            $("#sure").click(function () {
                if ($("#size-list").hasClass("dian") && $("#color-list").hasClass("dian")) {
                    return true;
                }else {
                    alert("請選擇尺碼、顏色分類");
                    return false;
                }
            });

//            $("#sure").click(function () {
//                if ($("#color-list").hasClass("dian")) {
//                    return true;
//                }else{
//                    alert("請選擇顏色分類");
//                    return false;
//                }
//            });






            $("#size-list").click(function () {
                if($("#size-list").hasClass("dian")) {
                    $("#size-list").removeClass("dian");
                } else {
                    $("#size-list").addClass("dian");
                }
            });

            $("#color-list").click(function () {
                if($("#color-list").hasClass("dian")) {
                    $("#color-list").removeClass("dian");
                } else {
                    $("#color-list").addClass("dian");
                }
            });





            //num
            //获得文本框对象
            var t = $("#num");

            t.on('blur', function () {
                if (t.val() <= 1) {
                    t.val("1");
                }
            })

            //初始化数量为1,并失效减
            $('#min').attr('disabled', true);
            //数量增加操作
            $("#add").click(function () {
                t.val(parseInt(t.val()) + 1)
                if (parseInt(t.val()) != 1) {
                    $('#min').attr('disabled', false);
                }

            })
            //数量减少操作
            $("#min").click(function () {
                if (parseInt(t.val()) <= 1 || (parseInt(t.val()) - 1) == 1) {
                    t.val("1");
                    $('#min').attr('disabled', true);
                    return;
                }
                t.val(parseInt(t.val()) - 1);
            })
            //num


        });

    </script>

</body>
</html>